package com.wenhai.spring.aop;

import org.springframework.aop.framework.ProxyFactory;

/**
 *
 *
 * @author wenhai
 * @date   2021/5/5
 */
public class AgentAOPDemo {
    public static void main(String[] args) {
        Agent agent = new Agent();
        ProxyFactory proxyFactory = new ProxyFactory();
        proxyFactory.addAdvice(new AgentDecorator());
        proxyFactory.setTarget(agent);
        Agent proxy = (Agent) proxyFactory.getProxy();
        agent.speek();
        System.out.println(" ");
        proxy.speek();
    }
}
